﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class index : System.Web.UI.Page
{
    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString.ToString());
    protected void Page_Load(object sender, EventArgs e)
    {
        zp.DataSource = select("招聘信息");
        zp.DataBind();
        px.DataSource = select("培训信息");
        px.DataBind();
        gy.DataSource = select("公寓信息");
        gy.DataBind();
        jj.DataSource = select("家教信息");
        jj.DataBind();
        qg.DataSource = select("物品求购");
        qg.DataBind();
        cs.DataSource = select("物品出售");
        cs.DataBind();
    }
    public DataSet select(string stype)
    {
        string sql = "select top 10 * from payinfo where type='" + stype + "' and show = 1 and showday >= GETDATE() order by date desc";
        SqlDataAdapter da = new SqlDataAdapter(sql,conn);
        DataSet ds = new DataSet();
        da.Fill(ds);
        return ds;
    }
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {

        Session["sqlstr"] = "select * from payinfo where type='" + type.Text + "' and info like '%" + sinfo.Text + "%'";

        Response.Redirect("seach.aspx");
    }
}